# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-stix2-patterns
_pkgname=cti-pattern-validator
pkgver=1.3.2
pkgrel=2
pkgdesc='Validate STIX 2 Patterns.'
url='https://github.com/oasis-open/cti-pattern-validator'
license=('BSD3')
arch=('any')
depends=('python' 'python-antlr4' 'python-six' 'python-typing')
makedepends=('git' 'python-setuptools')
source=("https://github.com/oasis-open/cti-pattern-validator/archive/v$pkgver.tar.gz")
sha512sums=('32c3b90402cdf42bc2f0da9523b59fc134cba23dead56ce573b705b12a6c4bc42f42e947792f8ce415f6a8a346747489c4763587627a873b84438fdc9ab9b83c')

pkgver() {
  git ls-remote --sort=v:refname -t --refs "$url" 'v*' \
  | sed -e 's/.*v//' -e '$!d'
}

build() {
  cd "$_pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

